import 'package:flutter/material.dart';
import 'package:wallet_home/collection/collection_qr_code.dart';
import 'package:wallet_home/page/coin_detail_page.dart';
import 'package:wallet_home/page/lang/lang_page.dart';
import 'package:wallet_home/page/theme/theme_page.dart';
import 'package:wallet_home/page/transfer_main_page.dart';
import 'package:wallet_home/search/pages/search_page.dart';
import 'package:wallet_home/search/pages/search_page_result.dart';
import 'address_book/pages/address_book_page.dart';
import 'address_book/pages/address_new_page.dart';
import 'page/coin_manager/wallet_details.dart';
import 'package:wallet_home/walletdetail/pages/export_private_key_page.dart';
import 'package:wallet_home/walletdetail/pages/private_key_export_list_page.dart';
import 'package:wallet_home/walletdetail/pages/wallet_detail_page.dart';
import 'package:wallet_home/walletdetail/pages/wallet_name_page.dart';
import 'page/main_page/wallet_home_page.dart';
import 'page/coin_manager/custom_amount.dart';
import 'page/qrcode/qrcode_generate.dart';
import 'page/qrcode/qrcode_scan.dart';
import 'page/coin_select/coin_select_page.dart';
import 'module_config.dart';

import 'package:route_manager/route_bridge.dart';

class ModuleWalletHome extends WXModuleRoute {
  @override
  String getModuleName() {
    return ModuleConfig.moduleName;
  }

  @override
  Route<dynamic> onGenerateRoute(setting) {
    switch (setting.name) {
      case '/custom_amount':
        return MaterialPageRoute(builder: (ctx) {
          return CustomAmountPage();
        });
        break;
      case '/qrcode_generate':
        return MaterialPageRoute(builder: (ctx) {
          return QRCodeGeneratePage();
        });
        break;
      case '/qrcode_scan':
        return MaterialPageRoute(builder: (ctx) {
          return QRCodeScan();
        });
        break;
      case '/wallet_home':
        return MaterialPageRoute(builder: (ctx) {
          return MainBottomTabView();
        });
        break;
      case '/wallet_search':
        return MaterialPageRoute(builder: (ctx) {
          return SearchPage();
        });
        break;
      case '/wallet_search_result':
        return MaterialPageRoute(builder: (ctx) {
          return SearchResultPage();
        });
      case '/coin_detail':
        return MaterialPageRoute(
            builder: (ctx) {
              return CoinDetailPage();
            },
            settings: setting);
        break;
      case '/transfer_main':
        return MaterialPageRoute(
            builder: (ctx) {
              return TransferMainPage();
            },
            settings: setting);
        break;
      case '/theme_page':
        return MaterialPageRoute(
            builder: (ctx) {
              return ThemePage();
            },
            settings: setting);
        break;
      case '/lang_page':
        return MaterialPageRoute(
            builder: (ctx) {
              return LangPage();
            },
            settings: setting);
        break;
      case '/wallet_coin_select':
        return MaterialPageRoute(
            builder: (ctx) {
              return CoinSelectPage();
            },
            settings: setting);
        break;

      case '/walletNamePage':
        // dynamic arguments = settings.arguments;
        return MaterialPageRoute(
            settings: setting,
            builder: (context) {
              return WalletNamePage();
            });
        break;

      case '/privateKeyExportListPage':
        return MaterialPageRoute(
            settings: setting,
            builder: (context) {
              return PrivateKeyExportListPage();
            });
        break;

      case '/exportPrivateKeyPage':
        String privateKey = setting.arguments;
        return MaterialPageRoute(
            settings: setting,
            builder: (context) {
              return ExportPrivateKeyPage(privateKey: privateKey);
            });
        break;

      case '/walletDetailPage':
        return MaterialPageRoute(
            settings: setting,
            builder: (context) {
              return WalletDetailPage();
            });
        break;
      case '/addressBookPage':
        String arguments = setting.arguments;

        return MaterialPageRoute(
            settings: setting,
            builder: (context) {
              return AddressBookPage(sourcePage: arguments);
            });
        break;
      case '/addressNewPage':
        dynamic arguments = setting.arguments;

        return MaterialPageRoute(
            settings: setting,
            builder: (context) {
              return AddressNewPage(
                addressItem: arguments,
              );
            });
        break;

      case '/collection_qr_code':
        return MaterialPageRoute(
            settings: setting,
            builder: (context) {
              return CollectionQRCodeView();
            });
        break;
    }
    return null;
  }
}
